/*******************************************************************************
 * Copyright (c) 2010 Gary Yund {OTHER COPYRIGHT OWNERS}.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Gary Yund - initial API and implementation and/or initial documentation
 *******************************************************************************/

#import <Foundation/Foundation.h>

/**
 
 \note
 While this class performs the CSV task, the downside is that it will load the 
 entire CSV file into an NSString object. The current interface has thus left 
 out references operations like getRecordNumber:(NSNumber). 
 Future implementation may change in the implementation to make this more 
 efficient by utilizing C libraries for getline.
 
 */
@interface BB_CSVParser : NSObject {
    NSArray * csvTable;
    NSInteger rowCount;
}

-(BB_CSVParser*)initWithContentsOfFile: (NSString*)path;

/**
 Returns an array with the column names. 
 
 \return
 Array of NSString objects representing the columns of the CSV file.
 
 */
-(NSArray*)getColumnNames;

/**
 Returns an array with the next record available. 
 
 \return
 When first called, it returns the first row after the column names. When no 
 more elements are left, nil is returned;
 */
-(NSArray*)getNextRecord;

/**
 Resets processing to the first data row after the column names.
 
 \return
 None.
 */
-(void)resetRowCount;


@property (nonatomic, retain) NSArray * csvTable;


@end
